<?php
/**
 * Created by JetBrains PhpStorm.
 * User: quangvu
 * Date: 5/25/13
 * Time: 9:52 AM
 * To change this template use File | Settings | File Templates.
 */

class HomeController extends BaseController {

    public function __construct() {
        parent::__construct();
        $this->load->model(array('Home', 'Post'));
        $this->load->helper(array('BlogInfo', 'Template'));
    }

    public function index() {
        //$this->testMemcached();
        $this->testPost();
    }

    private function testMemcached() {
        $model = new HomeModel();
        $model->setMessageCached('message','Message from cached', DEFAULT_KEY_TIMEOUT);
        $data['message'] = $model->getMessageCached();
        $data['MAIN_VIEW'] = 'home/index.php';
        $this->load->view('layouts/1-column.php', $data);
    }

    private function testPost() {
        $postModel = new PostModel();
        $data['posts'] = $postModel->getRecentPost(3);
        $data['MAIN_VIEW'] = 'home/index.php';
        $this->load->view('layouts/1-column.php', $data);
    }
}